package com.morristaedt.mirror.modules;

import java.util.List;

/**
 * Created by asm on 8/23/15.
 */
public class TrainScheduleModule {

    public int waitingSecondsForNextArrivalWithBufferSeconds(int bufferSeconds) {
        /*
        earliestArrivalAfterNowWithBufferSeconds(bufferSeconds) - (nowDaySeconds + bufferSeconds);
        */
        return 0;
    }

    public int earliestArrivalAfterNowWithBufferSeconds(int bufferSeconds) {
        // earliestArrivalAfterDaySeconds(nowDaySeconds+bufferSeconds);
        return 0;
    }

    public int earliestArrivalAfterDaySeconds (int afterDaySecs) {
        /*
        nowSchedule.find {
            time:
            Int =>time >= afterDaySecs
        } match {
            case Some(time: Int)=>time
            case _ =>((60 * 60 * 24) + nowSchedule(0))
        }
        */
        return 0;
    }

    public int nowDaySeconds() {
        /*
        val calendar:Calendar = Calendar.getInstance();
        val now:Long = calendar.getTimeInMillis();

        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);

        ((now - calendar.getTimeInMillis())/1000L).toInt;
        */
        return 0;
    }

    public int stringToDaySeconds(String daySecsString) {
        /*
        val elements = daySecsString.split(":")
        (
            (elements(0).toInt * 60 * 60)
                + (elements(1).toInt * 60)
                + elements(2).toInt
        ) % (60 * 60 * 24)
        */
        return 0;
    }

    public List<Integer> nowSchedule() {
        /*
        Calendar.getInstance().get(Calendar.DAY_OF_WEEK) match {
        case Calendar.SATURDAY => saturdaySchedule
        case Calendar.SUNDAY => sundaySchedule
        case _ => weekdaySchedule
        */
        return null;
    }

    /**
     * Weekday schedule for the F train out of
     * station F21N.
     */
    /*
    val weekdaySchedule:List[Int] = List(
        "02:30:30",
            "02:50:30",
            "03:10:30",
            "03:30:30",
            "03:50:30",
            "04:10:30",
            "04:30:30",
            "04:50:30",
            "05:10:00",
            "05:24:00",
            "05:38:00",
            "05:50:00",
            "06:02:00",
            "06:14:00",
            "06:24:00",
            "06:34:00",
            "06:44:00",
            "06:52:00",
            "06:59:00",
            "07:05:00",
            "07:11:00",
            "07:17:00",
            "07:23:00",
            "07:29:00",
            "07:34:00",
            "07:39:00",
            "07:44:00",
            "07:49:00",
            "07:53:00",
            "07:59:00",
            "08:03:30",
            "08:08:30",
            "08:13:30",
            "08:17:30",
            "08:21:30",
            "08:25:30",
            "08:29:30",
            "08:33:30",
            "08:37:30",
            "08:43:00",
            "08:48:30",
            "08:53:00",
            "08:58:00",
            "09:03:00",
            "09:08:00",
            "09:14:00",
            "09:20:00",
            "09:26:00",
            "09:32:00",
            "09:37:30",
            "09:44:00",
            "09:51:00",
            "09:58:00",
            "10:06:00",
            "10:14:00",
            "10:20:00",
            "10:29:00",
            "10:34:30",
            "10:42:00",
            "10:50:00",
            "10:59:00",
            "11:04:30",
            "11:11:30",
            "11:20:00",
            "11:27:30",
            "11:35:00",
            "11:42:00",
            "11:50:00",
            "11:57:30",
            "12:05:00",
            "12:12:00",
            "12:20:00",
            "12:27:30",
            "12:35:00",
            "12:42:00",
            "12:50:00",
            "12:57:30",
            "13:05:00",
            "13:12:00",
            "13:20:00",
            "13:27:30",
            "13:35:00",
            "13:42:00",
            "13:50:00",
            "13:57:30",
            "14:05:00",
            "14:12:00",
            "14:19:30",
            "14:25:30",
            "14:31:00",
            "14:37:00",
            "14:42:00",
            "14:49:00",
            "14:54:00",
            "15:01:00",
            "15:06:00",
            "15:12:00",
            "15:18:30",
            "15:25:00",
            "15:30:00",
            "15:37:00",
            "15:42:00",
            "15:48:30",
            "15:53:30",
            "15:58:30",
            "16:01:30",
            "16:08:00",
            "16:12:00",
            "16:18:00",
            "16:23:00",
            "16:25:30",
            "16:31:00",
            "16:34:00",
            "16:38:00",
            "16:41:00",
            "16:46:00",
            "16:50:00",
            "16:54:00",
            "16:57:30",
            "17:02:00",
            "17:06:00",
            "17:10:00",
            "17:14:00",
            "17:18:00",
            "17:22:00",
            "17:26:00",
            "17:31:00",
            "17:35:30",
            "17:40:30",
            "17:45:30",
            "17:51:30",
            "17:57:00",
            "18:01:30",
            "18:06:30",
            "18:11:00",
            "18:18:00",
            "18:22:00",
            "18:26:00",
            "18:33:00",
            "18:38:30",
            "18:44:00",
            "18:49:00",
            "18:53:00",
            "18:58:00",
            "19:04:00",
            "19:09:30",
            "19:14:00",
            "19:20:30",
            "19:25:00",
            "19:30:00",
            "19:36:00",
            "19:42:00",
            "19:48:00",
            "19:54:00",
            "20:00:00",
            "20:06:00",
            "20:12:00",
            "20:18:00",
            "20:24:00",
            "20:29:00",
            "20:36:00",
            "20:42:00",
            "20:48:00",
            "20:54:00",
            "21:02:00",
            "21:09:30",
            "21:17:00",
            "21:24:30",
            "21:32:00",
            "21:39:00",
            "21:44:30",
            "21:54:00",
            "22:04:00",
            "22:14:30",
            "22:24:30",
            "22:35:30",
            "22:47:30",
            "22:59:30",
            "23:11:30",
            "23:23:30",
            "23:35:30",
            "23:47:00",
            "23:59:00",
            "24:10:30",
            "24:22:30",
            "24:35:00",
            "24:50:30",
            "25:10:30",
            "25:30:30",
            "25:50:30",
            "26:10:30"
    ).map(stringToDaySeconds(_)).sortWith(_ < _)
    */

    /**
     * Saturday schedule for the F train out of
     * station F21N.
     */
    /*
    val saturdaySchedule:List[Int] = List(
        "02:30:30",
            "02:50:30",
            "03:10:30",
            "03:30:30",
            "03:50:30",
            "04:10:30",
            "04:30:30",
            "04:50:30",
            "05:10:30",
            "05:30:30",
            "05:50:30",
            "06:09:30",
            "06:27:00",
            "06:44:00",
            "06:59:30",
            "07:11:30",
            "07:24:30",
            "07:36:30",
            "07:48:30",
            "08:00:30",
            "08:12:30",
            "08:24:30",
            "08:35:30",
            "08:45:30",
            "08:55:30",
            "09:05:30",
            "09:15:30",
            "09:25:30",
            "09:35:30",
            "09:45:30",
            "09:55:30",
            "10:05:30",
            "10:15:30",
            "10:25:30",
            "10:35:30",
            "10:45:30",
            "10:55:30",
            "11:05:30",
            "11:15:30",
            "11:25:30",
            "11:35:30",
            "11:45:30",
            "11:55:30",
            "12:05:30",
            "12:15:30",
            "12:25:30",
            "12:35:30",
            "12:45:30",
            "12:55:30",
            "13:05:30",
            "13:15:30",
            "13:25:30",
            "13:35:30",
            "13:45:30",
            "13:55:30",
            "14:05:30",
            "14:15:30",
            "14:25:30",
            "14:35:30",
            "14:45:30",
            "14:55:30",
            "15:05:30",
            "15:15:30",
            "15:25:30",
            "15:35:30",
            "15:45:30",
            "15:55:30",
            "16:05:30",
            "16:15:30",
            "16:25:30",
            "16:35:30",
            "16:45:30",
            "16:55:30",
            "17:05:30",
            "17:15:30",
            "17:25:30",
            "17:35:30",
            "17:45:30",
            "17:55:30",
            "18:05:30",
            "18:15:30",
            "18:25:30",
            "18:35:30",
            "18:45:30",
            "18:55:30",
            "19:05:30",
            "19:15:30",
            "19:25:30",
            "19:35:30",
            "19:45:30",
            "19:55:30",
            "20:05:30",
            "20:15:30",
            "20:25:30",
            "20:35:30",
            "20:45:30",
            "20:55:30",
            "21:05:30",
            "21:16:00",
            "21:30:00",
            "21:41:30",
            "21:53:30",
            "22:05:30",
            "22:17:30",
            "22:29:30",
            "22:41:00",
            "22:53:00",
            "23:05:00",
            "23:17:00",
            "23:29:00",
            "23:41:00",
            "23:53:00",
            "24:05:00",
            "24:17:00",
            "24:30:30",
            "24:50:30",
            "25:10:30",
            "25:30:30",
            "25:50:30",
            "26:10:30"
    ).map(stringToDaySeconds(_)).sortWith(_ < _)
    */

    /**
     * Sunday schedule for the F train out of
     * station F21N.
     */
    /*
    val sundaySchedule:List[Int] = List(
        "02:30:30",
            "02:50:30",
            "03:10:30",
            "03:30:30",
            "03:50:30",
            "04:10:30",
            "04:30:30",
            "04:50:30",
            "05:10:30",
            "05:30:30",
            "05:50:30",
            "06:10:30",
            "06:30:30",
            "06:50:30",
            "07:10:30",
            "07:30:00",
            "07:49:00",
            "08:04:00",
            "08:19:30",
            "08:34:30",
            "08:49:30",
            "09:04:30",
            "09:16:30",
            "09:28:30",
            "09:40:30",
            "09:52:30",
            "10:04:30",
            "10:16:30",
            "10:28:30",
            "10:38:30",
            "10:48:30",
            "10:58:30",
            "11:08:30",
            "11:18:30",
            "11:28:30",
            "11:38:30",
            "11:48:30",
            "11:58:30",
            "12:08:30",
            "12:18:30",
            "12:28:30",
            "12:38:30",
            "12:48:30",
            "12:58:30",
            "13:08:30",
            "13:18:30",
            "13:28:30",
            "13:38:30",
            "13:48:30",
            "13:58:30",
            "14:08:30",
            "14:18:30",
            "14:28:30",
            "14:38:30",
            "14:48:30",
            "14:58:30",
            "15:08:30",
            "15:18:30",
            "15:28:30",
            "15:38:30",
            "15:48:30",
            "15:58:30",
            "16:08:30",
            "16:18:30",
            "16:28:30",
            "16:38:30",
            "16:48:30",
            "16:58:30",
            "17:08:30",
            "17:18:30",
            "17:28:30",
            "17:38:30",
            "17:48:30",
            "17:58:30",
            "18:08:30",
            "18:18:30",
            "18:28:30",
            "18:38:30",
            "18:48:30",
            "18:58:30",
            "19:08:30",
            "19:18:30",
            "19:28:30",
            "19:38:30",
            "19:48:30",
            "19:58:30",
            "20:08:30",
            "20:18:30",
            "20:29:30",
            "20:41:30",
            "20:53:30",
            "21:05:30",
            "21:17:30",
            "21:28:30",
            "21:40:30",
            "21:52:30",
            "22:04:30",
            "22:19:00",
            "22:34:00",
            "22:49:00",
            "23:04:00",
            "23:19:00",
            "23:34:00",
            "23:50:30",
            "24:10:30",
            "24:30:30",
            "24:50:30",
            "25:10:30",
            "25:30:30",
            "25:50:30",
            "26:10:30"
    ).map(stringToDaySeconds(_)).sortWith(_ < _)
    */
}
